Skip to content

Conversation

@mrm9084
Copy link
Contributor

@mrm9084 mrm9084 commented Sep 11, 2024

Description

Adds VariantAllocationPercentage, DefaultWhenEnabled, and AllocationId to telemetry.

Contribution checklist:

  • The pull request does not introduce [breaking changes]
  • CHANGELOG is updated for new features, bug fixes or other significant changes.
  • I have read the contribution guidelines.
  • Pull request includes test coverage for the included changes.

General Guidelines and Best Practices

  • Title of the pull request is clear and informative.
  • There are a small number of commits, each of which have an informative message. This means that previously merged commits do not appear in the history of the PR.

@mrm9084 mrm9084 merged commit 9403168 into main Oct 11, 2024
4 checks passed
@mrm9084 mrm9084 deleted the NewTelemetryValues branch October 11, 2024 16:23
allocation_percentage = 0
for allocation in evaluation_event.feature.allocation.percentile:
if (
evaluation_event.variant
Copy link
Member

@zhiyuanliang-ms zhiyuanliang-ms Oct 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better to check whether evaluation_event.variant is None in advance so that we can shortcircuit before the for loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a possible case that variantAssignmentReason is not None but variant is None? I cannot imagine it will happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zhiyuanliang-ms, I've made some changes already to this in my already existing PR that has some updates. #45


# DefaultWhenEnabled
if evaluation_event.feature.allocation and evaluation_event.feature.allocation.default_when_enabled:
event["DefaultWhenEnabled"] = evaluation_event.feature.allocation.default_when_enabled
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just want to call out that it is possible that variant assignment reason is defaultWhenEnabled but the assigned variant is empty/none. The reason of this design is that if we have empty allocation configuration, (in .NET) we can consider it as:

{
    "allocation": {
        "default_when_enabled" : ""
    }
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't whether it is a better choice to have event["DefaultWhenEnabled"] = "" when there is no allocation.default_when_enabled. But it could be another option for us.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

event["VariantAssignmentPercentage"] = str(100 - allocation_percentage)
elif evaluation_event.reason == VariantAssignmentReason.PERCENTILE:
if evaluation_event.feature.allocation and evaluation_event.feature.allocation.percentile:
allocation_percentage = 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move this line before the above if statement to make it consistent with line 70

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my latest PR. I already made these changes.

for allocation in evaluation_event.feature.allocation.percentile:
if (
evaluation_event.variant
and allocation.variant == evaluation_event.variant.name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rossgrambo @mrm9084 Can you confirm whether this line is by design please?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants